/*     */ package com.umeng.newxp.common;
/*     */ 
/*     */ import android.app.Activity;
/*     */ import android.app.ActivityManager;
/*     */ import android.app.ActivityManager.RunningTaskInfo;
/*     */ import android.content.ComponentName;
/*     */ import android.content.Context;
/*     */ import android.content.pm.ApplicationInfo;
/*     */ import android.content.pm.PackageManager;
/*     */ import android.content.res.Resources;
/*     */ import android.os.Build.VERSION;
/*     */ import android.os.Bundle;
/*     */ import android.text.TextUtils;
/*     */ import android.widget.ImageView;
/*     */ import com.umeng.common.Log;
/*     */ import com.umeng.common.b;
/*     */ import com.umeng.newxp.Promoter;
/*     */ import com.umeng.newxp.controller.ExchangeDataService;
/*     */ import java.util.ArrayList;
/*     */ import java.util.HashMap;
/*     */ import java.util.Iterator;
/*     */ import java.util.List;
/*     */ import java.util.Map;
/*     */ 
/*     */ public class g extends b
/*     */ {
/*     */   private static Map<String, String> d;
/*     */ 
/*     */   public static String a(Context paramContext, ExchangeDataService paramExchangeDataService)
/*     */   {
/*  46 */     String str = null;
/*  47 */     if ((paramExchangeDataService != null) && (!TextUtils.isEmpty(paramExchangeDataService.appkey)))
/*  48 */       str = paramExchangeDataService.appkey;
/*  49 */     else if (!TextUtils.isEmpty(ExchangeConstants.APPKEY))
/*  50 */       str = ExchangeConstants.APPKEY;
/*     */     else {
/*     */       try {
/*  53 */         PackageManager localPackageManager = paramContext.getPackageManager();
/*  54 */         ApplicationInfo localApplicationInfo = localPackageManager.getApplicationInfo(paramContext.getPackageName(), 128);
/*     */ 
/*  56 */         if (localApplicationInfo != null) {
/*  57 */           Object localObject = localApplicationInfo.metaData.get("UMENG_APPKEY");
/*  58 */           if (localObject != null)
/*  59 */             str = localObject.toString();
/*     */           else
/*  61 */             Log.a(ExchangeConstants.LOG_TAG, 
/*  62 */               "Could not read UMENG_APPKEY meta-data from AndroidManifest.xml.");
/*     */         }
/*     */       }
/*     */       catch (Exception localException) {
/*  66 */         Log.a(ExchangeConstants.LOG_TAG, 
/*  67 */           "Could not read UMENG_APPKEY meta-data from AndroidManifest.xml.", localException);
/*     */       }
/*     */     }
/*  70 */     return str;
/*     */   }
/*     */ 
/*     */   public static Map<String, String> d()
/*     */   {
/*  76 */     if ((d == null) || (d.size() < 1)) {
/*  77 */       d = new HashMap();
/*  78 */       d.put("Accept-Encoding", "gzip");
/*     */     }
/*  80 */     return d;
/*     */   }
/*     */ 
/*     */   public static String y(Context paramContext) {
/*  84 */     if (!TextUtils.isEmpty(ExchangeConstants.CHANNEL)) {
/*  85 */       return ExchangeConstants.CHANNEL;
/*     */     }
/*  87 */     Object localObject1 = "";
/*     */     try {
/*  89 */       PackageManager localPackageManager = paramContext.getPackageManager();
/*  90 */       ApplicationInfo localApplicationInfo = localPackageManager.getApplicationInfo(paramContext.getPackageName(), 128);
/*     */ 
/*  92 */       if ((localApplicationInfo != null) && (localApplicationInfo.metaData != null)) {
/*  93 */         Object localObject2 = localApplicationInfo.metaData.get("UMENG_CHANNEL");
/*  94 */         if (localObject2 != null) {
/*  95 */           String str = localObject2.toString();
/*  96 */           if (str != null)
/*  97 */             localObject1 = str;
/*     */         }
/*     */       }
/*     */     }
/*     */     catch (Exception localException) {
/* 102 */       localException.printStackTrace();
/*     */     }
/* 104 */     ExchangeConstants.CHANNEL = (String)localObject1;
/* 105 */     return localObject1;
/*     */   }
/*     */ 
/*     */   public static boolean a(String paramString, boolean paramBoolean, String[] paramArrayOfString) {
/* 109 */     if ((paramArrayOfString == null) || (paramArrayOfString.length < 1) || (paramString == null)) return false;
/* 110 */     for (String str : paramArrayOfString) {
/* 111 */       if ((paramBoolean) && (str.equalsIgnoreCase(paramString)))
/* 112 */         return true;
/* 113 */       if ((!paramBoolean) && (str.equals(paramString))) {
/* 114 */         return true;
/*     */       }
/*     */     }
/* 117 */     return false;
/*     */   }
/*     */ 
/*     */   public static void a(ImageView paramImageView, Context paramContext, ExchangeDataService paramExchangeDataService, a parama)
/*     */   {
/* 148 */     paramImageView.setVisibility(8);
/* 149 */     paramImageView.setClickable(false);
/*     */ 
/* 151 */     h localh = new h(parama, paramExchangeDataService, paramContext, paramImageView);
/*     */ 
/* 180 */     paramExchangeDataService.requestDataAsyn(paramContext, localh);
/*     */   }
/*     */ 
/*     */   public static int a(Context paramContext, String paramString1, String paramString2) {
/* 184 */     Resources localResources = paramContext.getResources();
/* 185 */     String str = paramContext.getPackageName();
/* 186 */     int i = localResources.getIdentifier(paramString2, paramString1, str);
/* 187 */     if (i <= 0)
/* 188 */       throw new RuntimeException("获取资源ID失败:(packageName=" + str + " type=" + 
/* 188 */         paramString1 + " name=" + paramString2);
/* 189 */     return i;
/*     */   }
/*     */ 
/*     */   public static String b(Context paramContext, ExchangeDataService paramExchangeDataService) {
/* 193 */     StringBuilder localStringBuilder = new StringBuilder("http://ex.mobmore.com/api/wap?sdk_version=" + 
/* 194 */       b.d(paramContext));
/* 195 */     if (!TextUtils.isEmpty(paramExchangeDataService.slot_id)) localStringBuilder.append("&slot_id=" + 
/* 196 */         paramExchangeDataService.slot_id);
/* 197 */     else if (!TextUtils.isEmpty(a(paramContext, paramExchangeDataService))) localStringBuilder.append("&app_key=" + 
/* 198 */         a(paramContext, paramExchangeDataService));
/*     */     else
/* 200 */       return null;
/* 201 */     return localStringBuilder.toString();
/*     */   }
/*     */ 
/*     */   public static List<Promoter> a(List<Promoter> paramList1, List<Promoter> paramList2)
/*     */   {
/* 212 */     ArrayList localArrayList = new ArrayList();
/*     */     Object localObject1;
/* 213 */     for (Object localObject2 = paramList2.iterator(); ((Iterator)localObject2).hasNext(); ) { localObject1 = (Promoter)((Iterator)localObject2).next();
/*     */ 
/* 215 */       if (!a(((Promoter)localObject1).app_package_name, paramList1))
/*     */       {
/* 217 */         localArrayList.add(localObject1);
/*     */       }
/*     */     }
/* 220 */     if (ExchangeConstants.DEBUG_MODE) {
/* 221 */       localObject1 = new StringBuilder();
/* 222 */       localObject2 = new StringBuilder();
/*     */       Promoter localPromoter;
/* 223 */       for (Iterator localIterator = localArrayList.iterator(); localIterator.hasNext(); ) { localPromoter = (Promoter)localIterator.next();
/* 224 */         ((StringBuilder)localObject1).append(localPromoter.title);
/* 225 */         ((StringBuilder)localObject1).append(", ");
/*     */       }
/* 227 */       for (localIterator = paramList2.iterator(); localIterator.hasNext(); ) { localPromoter = (Promoter)localIterator.next();
/* 228 */         ((StringBuilder)localObject2).append(localPromoter.title);
/* 229 */         ((StringBuilder)localObject2).append(", ");
/*     */       }
/* 231 */       Log.c(ExchangeConstants.LOG_TAG, "Showing next page data, before filtered: " + 
/* 232 */         ((StringBuilder)localObject2).toString());
/*     */ 
/* 234 */       Log.c(ExchangeConstants.LOG_TAG, 
/* 235 */         "Showing next page data, after filtered: " + ((StringBuilder)localObject1).toString());
/*     */     }
/* 237 */     return localArrayList;
/*     */   }
/*     */ 
/*     */   private static boolean a(String paramString, List<Promoter> paramList)
/*     */   {
/* 247 */     if ((paramString == null) || (paramList == null) || (paramList.size() < 1)) return false;
/* 248 */     for (Promoter localPromoter : paramList) {
/* 249 */       if ((!TextUtils.isEmpty(localPromoter.app_package_name)) && 
/* 250 */         (paramString.equalsIgnoreCase(localPromoter.app_package_name))) {
/* 251 */         return true;
/*     */       }
/*     */     }
/* 254 */     return false;
/*     */   }
/*     */ 
/*     */   public static int e() {
/* 258 */     int i = 0;
/*     */     try {
/* 260 */       i = Integer.valueOf(Build.VERSION.SDK).intValue();
/*     */     } catch (NumberFormatException localNumberFormatException) {
/* 262 */       Log.b(ExchangeConstants.LOG_TAG, localNumberFormatException.toString());
/*     */     }
/* 264 */     return i;
/*     */   }
/*     */ 
/*     */   public static boolean a(Activity paramActivity) {
/*     */     try {
/* 269 */       ActivityManager localActivityManager = (ActivityManager)paramActivity
/* 270 */         .getSystemService("activity");
/* 271 */       ComponentName localComponentName = ((ActivityManager.RunningTaskInfo)localActivityManager.getRunningTasks(1).get(0)).topActivity;
/* 272 */       String str = paramActivity.getClass().getName();
/* 273 */       Log.c(ExchangeConstants.LOG_TAG, localComponentName.getClassName() + "    " + str);
/* 274 */       if (str.equalsIgnoreCase(localComponentName.getClassName())) {
/* 275 */         return true;
/*     */       }
/* 277 */       return false; } catch (Exception localException) {
/*     */     }
/* 279 */     return false;
/*     */   }
/*     */ 
/*     */   public static abstract interface a
/*     */   {
/*     */     public abstract void a(ImageView paramImageView);
/*     */ 
/*     */     public abstract void a(List<Promoter> paramList);
/*     */ 
/*     */     public abstract void a(int paramInt);
/*     */   }
/*     */ }

/* Location:           C:\Users\Administrator\Desktop\umeng_sdk.jar
 * Qualified Name:     com.umeng.newxp.common.g
 * JD-Core Version:    0.6.2
 */